package com.zhiwei.controller;

import com.zhiwei.pojo.Bill;
import com.zhiwei.service.BillService;
import com.zhiwei.vo.PageResult;
import com.zhiwei.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/bill")
public class BillController {
    @Autowired
    private BillService billService;

    @RequestMapping("/addBill")
    public void addBill(Bill bill){
        billService.addBill(bill);
    }
    @DeleteMapping("/deleteById/{orderId}")
    public SysResult deleteById(@PathVariable Integer orderId){
        billService.deleteById(orderId);
        return SysResult.success();
    }
    @GetMapping("/list")
    public SysResult getBillList(PageResult pageResult){
        return SysResult.success(billService.getBillList(pageResult));
    }
}
